/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2013
 */

package com.gxuwz.byssxsys.model;

import javacommon.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */

@Entity
@Table(name = "admin")
public class Admin extends BaseEntity implements java.io.Serializable {
	private static final long serialVersionUID = 5454155825314635342L;

	// alias
	public static final String TABLE_ALIAS = "Admin";
	public static final String ALIAS_ID = "主键";
	public static final String ALIAS_ADMIN_NAME = "登录名字";
	public static final String ALIAS_ADMIN_PASSWORD = "登录密码";

	// date formats

	// 可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	// columns START
	/**
	 * 主键 db_column: id
	 */

	private java.lang.Integer id;
	/**
	 * 登录名字 db_column: admin_name
	 */
	@Length(max = 50)
	private java.lang.String adminName;
	/**
	 * 登录密码 db_column: admin_password
	 */
	@Length(max = 50)
	private java.lang.String adminPassword;

	// columns END

	public Admin() {
	}

	public Admin(java.lang.Integer id) {
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}

	@Id
	@GeneratedValue(generator = "custom-id")
	@GenericGenerator(name = "custom-id", strategy = "increment")
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getId() {
		return this.id;
	}

	@Column(name = "admin_name", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
	public java.lang.String getAdminName() {
		return this.adminName;
	}

	public void setAdminName(java.lang.String value) {
		this.adminName = value;
	}

	@Column(name = "admin_password", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
	public java.lang.String getAdminPassword() {
		return this.adminPassword;
	}

	public void setAdminPassword(java.lang.String value) {
		this.adminPassword = value;
	}

	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
				.append("Id", getId()).append("AdminName", getAdminName())
				.append("AdminPassword", getAdminPassword()).toString();
	}

	public int hashCode() {
		return new HashCodeBuilder().append(getId()).toHashCode();
	}

	public boolean equals(Object obj) {
		if (obj instanceof Admin == false)
			return false;
		if (this == obj)
			return true;
		Admin other = (Admin) obj;
		return new EqualsBuilder().append(getId(), other.getId()).isEquals();
	}
}
